package com.juc.cyclicbarrier.cyclicbarrier3;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

public class ThreadA extends Thread{
	/**
	 * 类CyclicBarrier 有屏障重置性 
	 * 验证此特性
	 * 结合getNumberWaiting() 进行  该方法是获得有几个线程已经到达屏障点
	 * 测试类在src/test/java下面相同路径下
	 * 
	 * 类CyclicBarrier parties 可以重置归0
	 */
	
	private CyclicBarrier cbRef;
	
	public ThreadA(CyclicBarrier cbRef) {
		super();
		this.cbRef = cbRef;
	}
	
	@Override
	public void run() {
		try {
			cbRef.await();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (BrokenBarrierException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	

}
